<?php
namespace app\common\model\mysql;
use think\Model;

class AdminUser extends Model {
    public function getAllUserList($limit){

        $result =  $this->limit($limit)->select()->toArray();

        return $result;
    }

    /**
     * 根据用户名字获取用户信息
     * getAdminUserByName
     * @param $AdminName
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getAdminUserByName($AdminName){

        $where = [
            "username" => $AdminName
        ];
        $result = $this->where($where)->find();
        return $result;
    }
    public function updateById($id,$data){
        $id = intval($id);
        $res = $this->where(
            [
                "id" => $id
            ]
        )->save($data);
        return $res;
    }
}